package day03;
import java.io.BufferedReader;
//客户端
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;

public class ClientA {

	public static void main(String[] args) throws UnknownHostException, IOException {
		// 127.0.0.1 localhost
		//执行。服务器端就可以通过acept（）接收到客户端
		Socket s=new Socket("localhost",8000);
		BufferedReader br =new BufferedReader(new InputStreamReader(s.getInputStream()));
		String str=br.readLine();
		//给服务器发送一条信息
		System.out.println(str);
		PrintWriter pw=new PrintWriter(s.getOutputStream(),true);
		pw.println("我是客户端");
		
	}

}
